package com.lineage.server.utils;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class DigitalUtil {
  private static final Log _log = LogFactory.getLog(DigitalUtil.class);
  
  public static long returnMin(long[] longs) {
    long i = -1L;
    try {
      int length = longs.length;
      int j = 0;
      while (j < length) {
        long count = longs[j];
        if (i == -1L)
          i = count; 
        i = Math.min(i, count);
        j++;
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
    return i;
  }
  
  public static long returnMin(int[] ints) {
    long i = -1L;
    try {
      int length = ints.length;
      int j = 0;
      while (j < length) {
        long count = ints[j];
        if (i == -1L)
          i = count; 
        i = Math.min(i, count);
        j++;
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
    return i;
  }
  
  public static long returnMin(short[] shorts) {
    long i = -1L;
    try {
      int length = shorts.length;
      int j = 0;
      while (j < length) {
        long count = shorts[j];
        if (i == -1L)
          i = count; 
        i = Math.min(i, count);
        j++;
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
    return i;
  }
  
  public static long returnMin(byte[] bytes) {
    long i = -1L;
    try {
      int length = bytes.length;
      int j = 0;
      while (j < length) {
        long count = bytes[j];
        if (i == -1L)
          i = count; 
        i = Math.min(i, count);
        j++;
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
    return i;
  }
  
  public static long returnMax(long[] longs) {
    long i = -1L;
    try {
      int length = longs.length;
      int j = 0;
      while (j < length) {
        long count = longs[j];
        i = Math.max(i, count);
        j++;
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
    return i;
  }
  
  public static long returnMax(int[] ints) {
    long i = -1L;
    try {
      int length = ints.length;
      int j = 0;
      while (j < length) {
        long count = ints[j];
        i = Math.max(i, count);
        j++;
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
    return i;
  }
  
  public static long returnMax(short[] shorts) {
    long i = -1L;
    try {
      int length = shorts.length;
      int j = 0;
      while (j < length) {
        long count = shorts[j];
        i = Math.max(i, count);
        j++;
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
    return i;
  }
  
  public static long returnMax(byte[] bytes) {
    long i = -1L;
    try {
      int length = bytes.length;
      int j = 0;
      while (j < length) {
        long count = bytes[j];
        i = Math.max(i, count);
        j++;
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
    return i;
  }
}
